//
//  BaseNavigationController.swift
//  JiaXiaoTong
//
//  Created by leo on 2018/2/5.
//  Copyright © 2018年 IT. All rights reserved.
//

import UIKit

class BaseNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if (self.viewControllers.count > 0 ){
            
            viewController.hidesBottomBarWhenPushed = true
            
        }
        super.pushViewController(viewController, animated: animated)
    }
    override var shouldAutorotate: Bool {
  
        guard self.topViewController is AliyunPlayerViewController else {
            
            return false
        }
        return (self.topViewController?.shouldAutorotate)!

    }
    override var supportedInterfaceOrientations: UIInterfaceOrientationMask{
        
        guard self.topViewController is AliyunPlayerViewController else {
            
          return UIInterfaceOrientationMask.portrait
            
        }
        return (self.topViewController?.supportedInterfaceOrientations)!
        
        
    }
    override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{
        
        return UIInterfaceOrientation.portrait
        
    }



}

